<include file="../header" />
<body style="margin-bottom:25px">
<script type="text/javascript">
    function processPage(id, page) {
        var url = "/admin/workorder/process?id=" + id + "&page=" + page + "&home=1";
        window.location.href = url;
    }
    $(window).resize(function() {
        window.location.reload()
    });
    $(document).ready(function(){
        if($(window).width() < 1200){
            $(".icon1-th").hide();
            $(".icon2-th").show();
            $(".icon1-br").show();
            $(".icon1-img").height(40);
            $(".icon1-img").width(40);
        }else{
            $(".icon1-th").show();
            $(".icon2-th").hide();
            $(".icon1-br").hide();
            $(".icon1-img").height(50);
            $(".icon1-img").width(50);
        }
    });

</script>
<style type="text/css">
    .btn-danger,.btn-info,.btn-success,.btn-warning{
        width: 70px;
        height: 19px;
        line-height: 19px;
        font-size: small;
        padding: 0px 1px 0px 1px;
        margin: 0px 0px 0px 0px;
    }
    td{
        border: solid 1px #e1e2ff;
    }
</style>
<!--form class="well form-search" method="post" style="float:left" action="{:U('Workorder/index')}">
    <div class="search_type cc mb10">
        <div class="mb10">
        <span class="mr20">
            状&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;态：{:getEnumSelectWidget($statusEnum, "wo#status", $status, 1)}
            &nbsp;工单号：<input type="text" name="wo#workorder_no-like" value="{$workorder_no}" />
            患者姓名：<input type="text" name="pt#patient_name-like" value="{$patient_name}" />
            <br>
            类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型：{:getEnumSelectWidget($typeEnum, "wo#workorder_type", $type, 1)}下单开始时间：<input type="text" value="{$begin_time}" class="date J_date" name="wo#create_time-egt" />
            下单截止时间：<input type="text" value="{$end_time}" class="date J_date" name="wo#create_time-elt" />
            <button class="btn btn-primary" type="submit">搜索</button>
            <a class="btn" href="{:U('Workorder/index')}">重置</a>
        </span>
        </div>
    </div>
</form-->
<div class="wrap J_check_wrap" style="padding: 1px 0px 0px 1px; overflow-x:auto;white-space:nowrap;">
    <php>$imgVersion = "2020101304";</php>
    <table class="table table-hover table-bordered" style="margin-bottom: 7px; border: solid 1px #e1e2ff;">
        <thead>
        <tr style="background-color: #F6F6Ff">
            <th style="line-height: 10px; min-width: 415px; border: solid 1px #e1e2ff;"><a style="color: #45a1de;" href="{:U('Workorder/index')}">最新定制矫形器工单信息 >>></a></th>
            <th style="line-height: 10px; min-width: 152px; width: 152px; color: #45a1de; border: solid 1px #e1e2ff;">工单状态</th>
            <th class="icon1-th" style="line-height: 10px; min-width: 410px; width: 410px; color: #45a1de; border: solid 1px #e1e2ff;">制作与入库</th>
            <th class="icon2-th" style="line-height: 10px; min-width: 160px; width: 160px; color: #45a1de; border: solid 1px #e1e2ff; display: none">制作与入库</th>
            <th style="line-height: 10px; min-width: 60px; width: 60px; color: #45a1de; border: solid 1px #e1e2ff; text-align: center">操作</th>
            <th style="line-height: 10px; min-width: 60px; width: 60px; color: #45a1de; border: solid 1px #e1e2ff; text-align: center">审核</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="workorderList" item="vo">
            <tr>
                <td style="padding: 0px 5px 0px 5px;">单号: {$vo.workorder_no} <a style="color: #e97c7d">{$vo.side}</a><if condition="$vo['delivery_date'] neq ''"> &nbsp;预计交付: <a>{$vo.delivery_date}</a></if>
                    <br>
                    患者: <a style="font-weight: bold" title="{$vo.sex}, {$vo.age}岁, {$vo.diagnosis}">{$vo.patient_name}</a>,
                    <if condition="$vo['workorder_type'] neq '3'">
                        类型: <a style="color: #FFA451">{$vo.type_name}</a>, 价格: <a style="color: #e97c7d">{$vo.price}</a>
                    </if>
                    <if condition="$vo['payment_status'] neq ''">
                        , <a>{$vo.payment_status}</a>
                    </if>
                    <if condition="$vo['deposit'] neq ''">
                        : <a style="color: #e97c7d">{$vo.deposit}</a>
                    </if>
                    <br>
                    检测: <a style="color: #45a1de">{$vo.examinator}</a>, 处方: <a style="color: #45a1de">{$vo.prescriber}</a>, 业务员: <a style="color: #45a1de">{$vo.sales}</a><if condition="$vo['reviewer'] neq ''">, 工序检查: <a>{$vo.reviewer}</a></if><if condition="$vo['auditor'] neq ''">, 质量检查: <a>{$vo.auditor}</a></if>
                    <br>
                    <if condition="$vo['status'] eq '-2'">
                        <a style="color: #e97c7d">工单已关闭</a>
                    </if>
                </td>
                <php>
                    $statusArr = array();
                    $statusArr["1"] = "出处方";
                    $statusArr["2"] = "已接单";
                    $statusArr["3"] = "制作中";
                    $statusArr["4"] = "完成";
                    $statusArr[$vo["status"]] .= "亮";
                </php>
                <td style="padding: 5px 2px 0px 0px; min-width: 160px; width: 160px;">
                    <img style="height: 50px;" src="/Template/images/{$statusArr.1}.png?v={$imgVersion}"/>
                    <img style="height: 50px;" src="/Template/images/arrow.png"/>
                    <!--<img style="width: 75px;" src="/Template/images/{$statusArr.2}.png?v={$imgVersion}"/>-->
                    <!--<img style="width: 25px;" src="/Template/images/arrow.png"/>-->
                    <img style="height: 50px;" src="/Template/images/{$statusArr.3}.png?v={$imgVersion}"/>
                    <img style="height: 50px;" src="/Template/images/arrow.png"/>
                    <img style="height: 50px;" src="/Template/images/{$statusArr.4}.png?v={$imgVersion}"/>
                </td>
                <php>
                    $processStatusArr=explode(",",$vo["process_status"]);
                    if(in_array($vo["workorder_type"],array('1','5','6','7')))
                        $processArr = array("取阴模", "检查取阴模","修阳模","检查修阳模","热塑成型","检查热塑成型","打磨抛光","检查打磨抛光","组装对线","半成品适配","穿戴及使用训练","入库");
                    if(in_array($vo["workorder_type"],array('2','4')))
                        $processArr = array("取阴模2", "检查取阴模2","修阳模2","检查修阳模2","热塑成型","检查热塑成型","打磨抛光","检查打磨抛光","组装对线","半成品适配2","穿戴及使用训练2","入库");
                    for($i = 0; $i < 12; $i++){
                        if($processStatusArr[$i] == "1"){
                            $processArr[$i] .= "亮";
                        }
                    }
                </php>
                <td style="padding: 5px 2px 0px 0px;">
                    <if condition="$orthosisProcess[0] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.0}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",1)' title="取阴模"/>
                    </if>
                    <if condition="$orthosisProcess[1] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.1}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",2)' title="检查取阴模"/>
                    </if>
                    <if condition="$orthosisProcess[2] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.2}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",3)' title="修阳模"/>
                    </if>
                    <if condition="$orthosisProcess[3] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.3}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",4)' title="检查修阳模"/>
                    </if>
                    <if condition="$orthosisProcess[4] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.4}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",5)' title="热塑成型"/>
                    </if>
                    <if condition="$orthosisProcess[5] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.5}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",6)' title="检查热塑成型"/>
                    </if>
                    <if condition="$orthosisProcess[6] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.6}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",7)' title="打磨抛光"/>
                    </if>
                    <br class="icon1-br" style="display: none">
                    <if condition="$orthosisProcess[7] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.7}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",8)' title="检查打磨抛光"/>
                    </if>
                    <if condition="$orthosisProcess[8] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.8}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",9)' title="组装对线"/>
                    </if>
                    <if condition="$orthosisProcess[9] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.9}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",10)' title="半成品适配"/>
                    </if>
                    <if condition="$orthosisProcess[10] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.10}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",11)' title="穿戴及使用训练"/>
                    </if>
                    <if condition="$orthosisProcess[11] eq '1'">
                        <img class="icon1-img" style="height: 50px;cursor: pointer;" src="/Template/images/{$processArr.11}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",12)' title="入库"/>
                    </if>
                </td>
                <td style="padding: 0px 2px 0px 2px;">
                    <if condition="$vo['status'] egt $statusEnum['WAITING_DISTPATCH']">
                        <!--a class="btn btn-success" href='{:U("workorder/viewworkorder",array("id"=>$vo["workorder_id"]))}'>接单</a>
                    <else/-->
                        <a class="btn btn-info" href='{:U("workorder/viewworkorder",array("id"=>$vo["workorder_id"]))}'>查看与打印</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">查看与打印</a>
                    </if>
                    <br/>
                    <php>
                        $prescriber = 0;
                        $employee_idArr = explode(',', $user['employee_id']);
                        foreach ($employee_idArr as $value) {
                            if($value == $vo['prescriber_id'] && $vo['status'] == '1'){
                                $prescriber = 1;
                            }
                        }
                        if($vo['status'] <= 1){
                            $prescriberText = "处方";
                        }
                        else{
                            $prescriber = 2;
                            $prescriberText = "已出处方";
                        }
                    </php>
                    <if condition="$prescriber eq 1">
                        <a class="btn btn-danger" href='{:U("workorder/rx",array("id"=>$vo["workorder_id"]))}'>{$prescriberText}</a>
                        <elseif condition="$prescriber eq 2"/>
                        <a disabled="disable" class="btn btn-danger">{$prescriberText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-danger">{$prescriberText}</a>
                    </if>
                    <br/>
                    <!--php>
                        $needProcess = "0";
                        for($i = 0; $i < 11; $i++){
                        if($processStatusArr[$i] != "1"){
                        $needProcess = "1";
                        }
                        }
                    </php>
                    <if condition="$needProcess eq '1' && $vo['status'] neq '-2'">
                        <a class="btn btn-info" href='{:U("workorder/process",array("id"=>$vo["workorder_id"],"home"=>"1"))}'>制作流程</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">制作流程</a>
                    </if>
                    <br/-->
                    <php>
                        $claimText = "领料";
                        $claimStatus = -1;
                        $role = explode(',',$user["role"]);
                        if(in_role($role,"8")){
                        if($vo["claim_status"] == -2 || isNullOrEmpty($vo["claim_status"])){
                        $claimText = "领料";
                        $claimStatus = 1;
                        }else{
                        $claimText = "已领料";
                        $claimStatus = 2;
                        }
                        }
                    </php>
                    <if condition="$claimStatus eq 1">
                        <a class="btn btn-info" href='{:U("workorder/claimMaterial",array("id"=>$vo["workorder_id"]))}' >{$claimText}</a>
                        <elseif condition="$claimStatus eq 2"/>
                        <a disabled="disable" class="btn btn-info">{$claimText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">{$claimText}</a>
                    </if>
                </td>
                <td style="padding: 0px 2px 0px 2px;">
                    <php>
                        $auditor = 0;
                        $role = explode(',',$user["role"]);
                        if(in_role($role,"9") &&  $vo["status"] > 1 ){
                            if($vo['audit_status'] != 1){
                                $statusArr=explode(",",$vo["process_status"]);
                                $auditor = 1;
                                $i = 0;
                                foreach ($statusArr as $statusValue) {
                                if($orthosisProcess[$i] == "1" && $i < 10 && $statusValue != "1"){
                                    $auditor = 0;
                                }
                                $i++;
                                }
                            }
                        }
                        if($vo['audit_status'] == 1){
                            $auditor = 2;
                            $auditorText = "已质量检验";
                        }
                        else
                        $auditorText = "质量检验";

                    </php>
                    <if condition="$auditor eq 1">
                        <a class="btn btn-info" href='{:U("workorder/audit",array("id"=>$vo["workorder_id"]))}' >{$auditorText}</a>
                        <elseif condition="$auditor eq 2"/>
                        <a disabled="disable" class="btn btn-info">{$auditorText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">{$auditorText}</a>
                    </if>
                    <br/>
                    <php>
                        $claimAuditText = "领料审核";
                        $claimAuditStatus = -1;
                        $role = explode(',',$user["role"]);
                        if(in_role($role,"4")){
                        if($vo["claim_status"] == -1){
                        $claimAuditText = "领料审核";
                        $claimAuditStatus = 1;
                        }
                        if($vo["claim_status"] == 1){
                        $claimAuditText = "领料反审核";
                        $claimAuditStatus = 1;
                        }
                        }
                    </php>
                    <if condition="$claimAuditStatus eq 1">
                        <a class="btn btn-info" href='{:U("workorder/claimMaterial",array("id"=>$vo["workorder_id"]))}'>{$claimAuditText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">{$claimAuditText}</a>
                    </if>
                    <br/>
                    <php>
                        $outStore = 0;
                        $outStoreText = "审核出库";
                    </php>
                    <php>
                        $outstoreText = "出库审核";
                        $outstoreStatus = -1;
                        $role = explode(',',$user["role"]);
                        if(in_role($role,"4")){
                        if($vo["workorder_status"] == 4 ||$vo["outstore_status"] != 1 ){
                        $outstoreText = "出库审核";
                        $outstoreStatus = 1;
                        }
                        if($vo["outstore_status"] == 1){
                        $outstoreText = "出库反审核";
                        $outstoreStatus = 1;
                        }
                        }
                    </php>
                    <if condition="$outstoreStatus eq 1">
                        <a class="btn btn-info" href='{:U("workorder/outstore",array("id"=>$vo["workorder_id"]))}'>{$outstoreText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">{$outStoreText}</a>
                    </if>
                </td>
            </tr>
        </foreach>
        </tbody>
    </table>
    <table class="table table-hover table-bordered" style="margin-bottom: 7px; border: solid 1px #e1e2ff;">
        <thead>
        <tr style="background-color: #F6F6Ff">
            <th style="line-height: 10px; min-width: 415px; border: solid 1px #e1e2ff;"><a style="color: #ed7667;" href="{:U('Workorder/indexProsthesis')}">最新假肢工单信息 >>></a></th>
            <th style="line-height: 10px; min-width: 152px; width: 152px; color: #ed7667; border: solid 1px #e1e2ff;">工单状态</th>
            <th class="icon1-th" style="line-height: 10px; min-width: 410px; width: 410px; color: #45a1de; border: solid 1px #e1e2ff;">制作与入库</th>
            <th class="icon2-th" style="line-height: 10px; min-width: 160px; width: 160px; color: #45a1de; border: solid 1px #e1e2ff; display: none">制作与入库</th>
            <th style="line-height: 10px; min-width: 60px; width: 60px; color: #ed7667; border: solid 1px #e1e2ff; text-align: center">操作</th>
            <th style="line-height: 10px; min-width: 60px; width: 60px; color: #ed7667; border: solid 1px #e1e2ff; text-align: center">审核</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="workorderList1" item="vo">
            <tr>
                <td style="padding: 0px 5px 0px 5px;">单号: {$vo.workorder_no} <a style="color: #e97c7d">{$vo.side}</a><if condition="$vo['delivery_date'] neq ''"> &nbsp;预计交付: <a>{$vo.delivery_date}</a></if>
                    <br>
                    患者: <a style="font-weight: bold" title="{$vo.sex}, {$vo.age}岁, {$vo.diagnosis}">{$vo.patient_name}</a>,
                    <if condition="$vo['workorder_type'] neq '3'">
                        类型: <a style="color: #FFA451">{$vo.type_name}</a>, 价格: <a style="color: #e97c7d">{$vo.price}</a>, 预付款: <a style="color: #e97c7d">{$vo.deposit}</a>
                    </if>
                    <br>
                    检测: <a style="color: #45a1de">{$vo.examinator}</a>, 处方: <a style="color: #45a1de">{$vo.prescriber}</a>, 业务员: <a style="color: #45a1de">{$vo.sales}</a><if condition="$vo['reviewer'] neq ''">, 工序检查: <a>{$vo.reviewer}</a></if><if condition="$vo['auditor'] neq ''">, 质量检查: <a>{$vo.auditor}</a></if>
                    <br>
                    <if condition="$vo['status'] eq '-2'">
                        <a style="color: #e97c7d">工单已关闭</a>
                    </if>
                </td>
                <php>
                    $statusArr = array();
                    $statusArr["1"] = "出处方";
                    $statusArr["3"] = "制作";
                    $statusArr["4"] = "已完成";
                    $statusArr[$vo["status"]] .= "亮";
                </php>
                <td style="padding: 5px 2px 0px 0px;">
                    <img style="height: 50px;" src="/Template/images/{$statusArr.1}.png?v={$imgVersion}"/>
                    <img style="height: 50px;" src="/Template/images/arrow.png"/>
                    <img style="height: 50px;" src="/Template/images/{$statusArr.3}.png?v={$imgVersion}"/>
                    <img style="height: 50px;" src="/Template/images/arrow.png"/>
                    <img style="height: 50px;" src="/Template/images/{$statusArr.4}.png?v={$imgVersion}"/>
                </td>
                <php>
                    $processStatusArr=explode(",",$vo["process_status"]);
                    $processArr = array("接受腔制作", "装配","假肢入库");
                    for($i = 0; $i < 3; $i++){
                    if($processStatusArr[$i] == "1"){
                    $processArr[$i] .= "亮";
                    }
                    }
                </php>
                <td style="padding: 5px 2px 0px 5px;">
                    <if condition="$prosthesisProcess[0] eq '1'">
                    <img style="height: 50px;;cursor: pointer;" src="/Template/images/{$processArr.0}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",1)' title="接受腔制作"/>
                    </if>
                    <if condition="$prosthesisProcess[1] eq '1'">
                        <img style="height: 50px;;cursor: pointer;" src="/Template/images/{$processArr.1}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",2)' title="装配"/>
                    </if>
                    <if condition="$prosthesisProcess[2] eq '1'">
                        <img style="height: 50px;;cursor: pointer;" src="/Template/images/{$processArr.2}.png?v={$imgVersion}" onclick='javascript:processPage("{$vo.workorder_id}",3)' title="入库"/>
                    </if>
                </td>
                <td style="padding: 0px 2px 0px 2px;">
                    <if condition="$vo['status'] egt $statusEnum['WAITING_DISTPATCH']">
                        <!--a class="btn btn-success" href='{:U("workorder/viewworkorder",array("id"=>$vo["workorder_id"]))}'>接单</a>
                    <else/-->
                        <a class="btn btn-info" href='{:U("workorder/viewworkorder",array("id"=>$vo["workorder_id"]))}'>查看与打印</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">查看与打印</a>
                    </if>
                    <br/>
                    <php>
                        $prescriber = 0;
                        $employee_idArr = explode(',', $user['employee_id']);
                        foreach ($employee_idArr as $value) {
                        if($value == $vo['prescriber_id'] && $vo['status'] == '1'){
                        $prescriber = 1;
                        }
                        }
                        if($vo['status'] <= 1){
                        $prescriberText = "处方";
                        }
                        else{
                        $prescriber = 2;
                        $prescriberText = "已出处方";
                        }
                    </php>
                    <if condition="$prescriber eq 1">
                        <a class="btn btn-danger" href='{:U("workorder/rx",array("id"=>$vo["workorder_id"]))}'>{$prescriberText}</a>
                        <elseif condition="$prescriber eq 2"/>
                        <a disabled="disable" class="btn btn-danger">{$prescriberText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-danger">{$prescriberText}</a>
                    </if>
                    <br/>
                    <!--php>
                        $needProcess = "0";
                        for($i = 0; $i < 11; $i++){
                        if($processStatusArr[$i] != "1"){
                        $needProcess = "1";
                        }
                        }
                    </php>
                    <if condition="$needProcess eq '1' && $vo['status'] neq '-2'">
                        <a class="btn btn-info" href='{:U("workorder/process",array("id"=>$vo["workorder_id"],"home"=>"1"))}'>制作流程</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">制作流程</a>
                    </if>
                    <br/-->
                    <php>
                        $claimText = "领料";
                        $claimStatus = -1;
                        $role = explode(',',$user["role"]);
                        if(in_role($role,"8")){
                        if($vo["claim_status"] == -2 || isNullOrEmpty($vo["claim_status"])){
                        $claimText = "领料";
                        $claimStatus = 1;
                        }else{
                        $claimText = "已领料";
                        $claimStatus = 2;
                        }
                        }
                    </php>
                    <if condition="$claimStatus eq 1">
                        <a class="btn btn-info" href='{:U("workorder/claimMaterial",array("id"=>$vo["workorder_id"]))}' >{$claimText}</a>
                        <elseif condition="$claimStatus eq 2"/>
                        <a disabled="disable" class="btn btn-info">{$claimText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">{$claimText}</a>
                    </if>
                </td>
                <td style="padding: 0px 2px 0px 2px;">
                    <php>
                        $auditor = 0;
                        $role = explode(',',$user["role"]);
                        if(in_role($role,"9") &&  $vo["status"] > 1 ){
                        if($vo['audit_status'] != 1){
                        $statusArr=explode(",",$vo["process_status"]);
                        $auditor = 1;
                        $i = 0;
                        foreach ($statusArr as $statusValue) {
                        if($prosthesisProcess[$i] == "1" && $i < 3 && $statusValue != "1"){
                        $auditor = 0;
                        }
                        $i++;
                        }
                        }
                        }
                        if($vo['audit_status'] == 1){
                        $auditor = 2;
                        $auditorText = "已质量检验";
                        }
                        else
                        $auditorText = "质量检验";

                    </php>
                    <if condition="$auditor eq 1">
                        <a class="btn btn-info" href='{:U("workorder/audit",array("id"=>$vo["workorder_id"]))}' >{$auditorText}</a>
                        <elseif condition="$auditor eq 2"/>
                        <a disabled="disable" class="btn btn-info">{$auditorText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">{$auditorText}</a>
                    </if>
                    <br/>
                    <php>
                        $claimAuditText = "领料审核";
                        $claimAuditStatus = -1;
                        $role = explode(',',$user["role"]);
                        if(in_role($role,"4")){
                        if($vo["claim_status"] == -1){
                        $claimAuditText = "领料审核";
                        $claimAuditStatus = 1;
                        }
                        if($vo["claim_status"] == 1){
                        $claimAuditText = "领料反审核";
                        $claimAuditStatus = 1;
                        }
                        }
                    </php>
                    <if condition="$claimAuditStatus eq 1">
                        <a class="btn btn-info" href='{:U("workorder/claimMaterial",array("id"=>$vo["workorder_id"]))}'>{$claimAuditText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">{$claimAuditText}</a>
                    </if>
                    <br/>
                    <php>
                        $outStore = 0;
                        $outStoreText = "审核出库";
                    </php>
                    <php>
                        $outstoreText = "出库审核";
                        $outstoreStatus = -1;
                        $role = explode(',',$user["role"]);
                        if(in_role($role,"4")){
                        if($vo["workorder_status"] == 4 ||$vo["outstore_status"] != 1 ){
                        $outstoreText = "出库审核";
                        $outstoreStatus = 1;
                        }
                        if($vo["outstore_status"] == 1){
                        $outstoreText = "出库反审核";
                        $outstoreStatus = 1;
                        }
                        }
                    </php>
                    <if condition="$outstoreStatus eq 1">
                        <a class="btn btn-info" href='{:U("workorder/outstore",array("id"=>$vo["workorder_id"]))}'>{$outstoreText}</a>
                        <else/>
                        <a disabled="disable" style="background-color: #93949c" class="btn btn-info">{$outStoreText}</a>
                    </if>
                </td>
            </tr>
        </foreach>
        </tbody>
    </table>
    <table class="table table-hover table-bordered" style="margin-bottom: 0px; border: solid 1px #e1e2ff;">
        <thead>
        <tr style="background-color: #F6F6Ff">
            <th style="line-height: 10px; min-width: 415px; border: solid 1px #e1e2ff;"><a style="color: #5fcc54;" href="{:U('FinishedOrder/index')}">最新成品分销订单信息 >>></a></th>
            <th style="line-height: 10px; min-width: 152px; width: 152px; color: #5fcc54; border: solid 1px #e1e2ff;">工单状态</th>
            <th class="icon1-th" style="line-height: 10px; min-width: 410px; width: 410px; color: #45a1de; border: solid 1px #e1e2ff;"></th>
            <th class="icon2-th" style="line-height: 10px; min-width: 160px; width: 160px; color: #45a1de; border: solid 1px #e1e2ff; display: none"></th>
            <th style="line-height: 10px; min-width: 60px; width: 60px; color: #5fcc54; border: solid 1px #e1e2ff;"></th>
            <th style="line-height: 10px; min-width: 60px; width: 60px; color: #5fcc54; border: solid 1px #e1e2ff; text-align: center">操作</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="finishedOrderList" item="vo">
            <tr>
                <td style="padding: 0px 5px 0px 5px;">
                    <a style="font-weight: bold">{$vo.name}</a>, <a style="color: #ed7667">{$vo.number}</a> 件, 规格: <a style="color: #45A1DE">{$vo.size}</a>, 单价: <a style="color: #ed7667">{$vo.sale_price}</a>,  总计: <a style="color: #ed7667">{$vo.total_price}</a>&nbsp;元
                    <br/>
                    单号: {$vo.finished_order_no}, 业务员: <a style="color: #45a1de">{$vo.admin_name}</a> <a style="color: #ffa451">[{$vo.payment_type}]</a> <a>{$vo.agent_name}</a>
                    <br/>
                    配送: <a style="color: #FFA451">{$vo.delivery_type}</a>
                    <if condition="$vo['delivery_type'] neq '自提'"><a style="color: #FFA451; font-weight: bold;" title="{$vo.receive_name}, {$vo.receive_contact}, {$vo.receive_address}">(查看)</a></if>
                    , 发票: <a style="color: #1DCCAA">{:getEnumString($defaultEnum, $vo['need_invoice'])}</a>
                    <if condition="$vo['need_invoice'] eq '1'"><a style="color: #1DCCAA; font-weight: bold;" title="{$vo.invoice_name} {$vo.invoice_number} {$vo.invoice_detail}">(查看)</a></if>
                    <if condition="$vo['note'] neq ''">, <a style="color: #ed7667; font-weight: bold;" title="{$vo.note}">备注(查看)</a></if>
                    <if condition="$vo['patient_name'] neq ''">, 患者: {$vo.patient_name}</if>
                </td>
                <php>
                    $statusArr = array();
                    $statusArr["-1"] = "处理中";
                    $statusArr["1"] = "已出库";
                    $statusArr[$vo["status"]] .= "亮";
                </php>
                <td style="padding: 5px 2px 0px 0px;">
                    <img style="height: 50px;" src="/Template/images/{$statusArr.-1}.png?v={$imgVersion}"/>
                    <img style="height: 50px;" src="/Template/images/arrow.png"/>
                    <img style="height: 50px;" src="/Template/images/{$statusArr.1}.png?v={$imgVersion}"/>
                </td>
                <td style="background-image: repeating-linear-gradient(45deg, #FCFCFf, #FCFCFf 3px, #dac8e8 3px, #FCFCFf 50%);background-size: 6px 6px;"></td>
                <td style="background-image: repeating-linear-gradient(45deg, #FCFCFf, #FCFCFf 3px, #dac8e8 3px, #FCFCFf 50%);background-size: 6px 6px;"></td>
                <td style="padding: 0px 2px 0px 2px; max-width: 80px">
                    <if condition="$vo['status'] eq '-1'">
                        <a class="btn btn-info" href='{:U("finishedOrder/endDelivery",array("id"=>$vo["finished_order_id"]))}'>确认出库</a>
                        <br/>
                        <a class="btn btn-danger" onclick="if(confirm('确认关闭此订单么?')==false)return false;" href='{:U("finishedOrder/closeOrder",array("id"=>$vo["finished_order_id"]))}' >关闭订单</a>
                    </if>
                    <if condition="$vo['status'] eq '1'">
                        <a disabled="disable" class="btn btn-info" title="出库人：{$vo.delivery_name}&#10;{$vo.outstock_time}&#10;{$vo.express_company} {$vo.delivery_number}">已出库</a>
                    </if>
                    <if condition="$vo['status'] eq '-2'">
                        <a disabled="disable" class="btn btn-info">已关闭</a>
                    </if>
                    <if condition="$vo['approve_id'] gt 0 && $vo['status'] neq '-2'">
                        <br>&nbsp;&nbsp;&nbsp;<a style="color: #1dccaa" title="审批人：{$vo.approve_name}">【审批通过】</a>
                    </if>
                    <if condition="$vo['approve_id'] gt 0 && $vo['status'] eq '-2'">
                        <br><a style="color: #ed7667" title="审批人：{$vo.approve_name}">【审批未通过】</a>
                    </if>
                </td>

            </tr>
        </foreach>
        </tbody>
    </table>
    </div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>